<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="java.util.*"%>
<%@ page import="priv.tuyou.util.UrlUtil"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	//获取请求的参数，自动添加到地址栏后面
	Map<String, String> params = UrlUtil.getMap(request);
	params.remove("pager.offset");
	String paramsStr = UrlUtil.mapToString(params);
	paramsStr = StringUtils.isBlank(paramsStr) ? null : "&" + paramsStr;
	request.setAttribute("params", paramsStr);
%>
<c:if test="${!empty PAGE_KEY && PAGE_KEY.totalCount > 0 }">
	<ul class="pagination">
		<li class="disabled"><a href="javascript:void();">总数：${PAGE_KEY.totalCount }条</a></li>
		<pg:pager url="${URI }" items="${PAGE_KEY.totalCount }" export="currentPageNumber=pageNumber" maxPageItems="${PAGE_KEY.pageSize }">
			<pg:first>
				<c:if test="${currentPageNumber != 1 }">
				<li><a href="${pageUrl}${params }"><i class="ace-icon fa fa-angle-double-left"></i></a></li>
				</c:if>
			</pg:first>
			<pg:prev>
				<li><a href="${pageUrl}${params }"><i class="ace-icon fa fa-angle-left"></i></a></li>
			</pg:prev>
			<pg:pages>
				<c:choose>
					<c:when test="${currentPageNumber eq pageNumber }">
						<li class="active"><a href="javascript:;">${pageNumber}</a></li>
					</c:when>
					<c:otherwise>
						<li><a href="${pageUrl}${params }">${pageNumber}</a></li>
					</c:otherwise>
				</c:choose>
			</pg:pages>
			<pg:next>
				<li><a href="${pageUrl}${params }"><i class="ace-icon fa fa-angle-right"></i></a></li>
			</pg:next>
			<pg:last>
				<c:if test="${currentPageNumber != pageNumber }">
				<li><a href="${pageUrl}${params }"><i class="ace-icon fa fa-angle-double-right"></i></a></li>
				</c:if>
			</pg:last>
		</pg:pager>
	</ul>
</c:if>